package com.da.javatest.leetCode;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chenlida
 * @date 2018/12/17 19:48
 * @description
 */
public class Code500 {
    private String s1 = "qwertyuiop";
    private String s2 = "asdfghjkl";
    private String s3 = "zxcvbnm";

    public String[] findWords(String[] words) {
        List<String> strs = new ArrayList<>();
        for (String word : words) {
            for (char c : word.toLowerCase().toCharArray()) {
                if (!s1.contains(c + "")) {
                    break;
                }
                strs.add(word);
            }
            for (char c : word.toLowerCase().toCharArray()) {
                if (!s2.contains(c + "")) {
                    break;
                }
                strs.add(word);
            }
            for (char c : word.toLowerCase().toCharArray()) {
                if (!s3.contains(c + "")) {
                    break;
                }
                strs.add(word);
            }
        }
        return strs.toArray(new String[strs.size()]);
    }
}
